﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;

namespace dotHTML.HTML {
    /// <summary>
    /// Represents an HTML body.
    /// </summary>
    [Serializable]
    public class Body : Element {
        private Color? _alink;
        private string _background;
        private Color? _bgcolor;
        private Color? _link;
        private Color? _text;
        private Color? _vlink;

        /// <summary>
        /// Gets or sets the color for active links.
        /// </summary>
        [Obsolete("Deprecated in HTML4 - use CSS instead.")]
        public Color? ALink {
            get { return _alink; }
            set { _alink = value; }
        }

        /// <summary>
        /// Gets or sets the background image URL.
        /// </summary>
        [Obsolete("Deprecated in HTML4 - use CSS instead.")]
        public string Background {
            get { return _background; }
            set { _background = value; }
        }

        /// <summary>
        /// Gets or sets the background color.
        /// </summary>
        [Obsolete("Deprecated in HTML4 - use CSS instead.")]
        public Color? BGColor {
            get { return _bgcolor; }
            set { _bgcolor = value; }
        }

        /// <summary>
        /// Gets or sets the color for links.
        /// </summary>
        [Obsolete("Deprecated in HTML4 - use CSS instead.")]
        public Color? Link {
            get { return _link; }
            set { _link = value; }
        }

        /// <summary>
        /// Gets or sets the color for text.
        /// </summary>
        [Obsolete("Deprecated in HTML4 - use CSS instead.")]
        public Color? Text {
            get { return _text; }
            set { _text = value; }
        }

        /// <summary>
        /// Gets or sets the color for visited links.
        /// </summary>
        [Obsolete("Deprecated in HTML4 - use CSS instead.")]
        public Color? VLink {
            get { return _vlink; }
            set { _vlink = value; }
        }

        /// <summary>
        /// Gets a formatted string of all local attributes of this element
        /// (not including the base attributes).
        /// </summary>
        /// <param name="sb">The StringBuilder to write this element's
        /// attribute data to.</param>
        protected override void WriteLocalAttributes(StringBuilder sb) {
            AttributeWriter.Write(sb, _alink, "alink");
            AttributeWriter.Write(sb, _background, "background");
            AttributeWriter.Write(sb, _bgcolor, "bgcolor");
            AttributeWriter.Write(sb, _link, "link");
            AttributeWriter.Write(sb, _text, "text");
            AttributeWriter.Write(sb, _vlink, "vlink");
        }
    }
}
